@extends('business/layout')
@section('content')

    
	    <div class="content-wrapper">

        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                商品管理
                <small>添加</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 后台主页</a></li>
                <li><a href="#">商品管理</a></li>
                <li class="active">添加</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="con
        tent">
            <div class="row">
                <!-- left column -->
                <div class="col-md-12">
                    <!-- general form elements -->
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title">快速添加商品</h3>
                        </div><!-- /.box-header -->
                        <!-- form start -->

                        @if(session('info'))
                            <div  id = 'showhidden' class="alert alert-success alert-dismissable">
                                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                                <h4>    <i class="icon fa fa-check"></i>提示!</h4>
                                    {{ session('info') }}
                             </div>
                        @endif
							
                       

                        <form role="form" action = "{{url('/business/goods/insert')}}" method = "post" enctype = "multipart/form-data">
                           	{{ csrf_field() }}
                            <div class="box-body">
							@if(count($errors)>0)
	                            <div class="alert alert-danger alert-dismissable">
				                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
				                    <h4><i class="icon fa fa-ban"></i> 警告!</h4>
				                    	<ul>
											@foreach($errors->all() as $error)
											<li>
												{{$error}}
											</li>
											@endforeach
										</ul>
			                  	</div>
							@endif	
									
                                <div class="form-group">
                                    <label for="exampleInputEmail1">商品名称</label>
                                    <input type="text" class="form-control" name = 'proname' id="exampleInputEmail1"
                                           placeholder="请输入商品名称">
                                </div>
                                
                               
                                 <div class="form-group">
                                    <label>商品分类</label>
                                    <select class="form-control" name = 'pid'>
                                        <option value = '0'>次分类</option>
                                        @foreach($goods as $good)
                                        <option value = "{{ $good -> id }}" 
                                            @if($good -> pid != 0)
                                                disabled = 'disabled'
                                                style = 'background:#C4CEDE;'
                                            @endif
                                        >{{ $good -> proname }}</option>
                                        @endforeach
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">单价</label>
                                    <input type="text" class="form-control" name = 'price' id="exampleInputEmail1"
                                           placeholder="请输入商品单价">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputFile">上传图片</label>
                                    <input type="file" id="exampleInputFile" name = 'image'>
                                    <p class="help-block">请上传一张图片</p>
                                </div>
                                
                                
                            </div><!-- /.box-body -->

                            <div class="box-footer">
                                <button type="submit" class="btn btn-primary">添加</button>
                            </div>
                        </form>


                    </div><!-- /.box -->

                            </div><!-- /input-group -->
                        </div><!-- /.box-body -->
                    </div><!-- /.box -->

                </div><!--/.col (left) -->
          
            </div>   <!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->


@endsection